package com.open.jack.jk_player_demo.webview;

import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.webkit.WebViewAssetLoader;
import androidx.webkit.WebViewClientCompat;


import com.open.jack.jk_player.JkPlayerVideo;
import com.open.jack.jk_player_demo.databinding.ActivityWebPlayerBinding;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


public class WebViewActivity extends AppCompatActivity {
    JkPlayerVideo jkPlayerView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityWebPlayerBinding binding = ActivityWebPlayerBinding.inflate(getLayoutInflater());
        View rootView = binding.getRoot();
        setContentView(rootView);

         jkPlayerView = binding.jkPlayerView;

    }

    public void click(View view) {
        String url = "rtsp://admin:1qaz2wsx@192.168.20.122/cam/realmonitor?channel=1&subtype=0";
        //url="ws://192.168.20.110:8080/play/296a6dd9-e8de-403a-b675-ad256e3dca75/87feaa18-0258-4d49-ba63-63648627cce9.flv";
        jkPlayerView.play(url);
    }

    public void click2(View view) {
        String url = "rtsp://admin:1qaz2wsx@192.168.20.122/cam/realmonitor?channel=1&subtype=0";
        url="ws://192.168.20.110:8080/play/296a6dd9-e8de-403a-b675-ad256e3dca75/87feaa18-0258-4d49-ba63-63648627cce9.flv";
        jkPlayerView.play(url);
    }
    @Override
    protected void onStart() {
        super.onStart();
        jkPlayerView.onStart();
    }
}
